# import math
# import os
# import sys
# import time
# from itertools import groupby
# from operator import itemgetter
#
# from tqdm import tqdm
#
# from src.tasks.regionSpread import CustomJsonEncoder
# from src.tasks.regionSpread.CustomJsonEncoder import toJson
# from src.utils import BatchUtils
#
# # 将工程目录加入包扫描
# currPath = os.path.abspath(os.path.dirname(__file__))
# srcPath = os.path.split(currPath)[0]
# rootPath = os.path.split(srcPath)[0]
# projectPath = os.path.split(rootPath)[0]
# sys.path.append(projectPath)
#
# from src.db.CcxDataCenterDb import CcxDataCenter
# from src.db.ProdDb import ProdDb
# from src.utils.LogUtils import Logger
# from src.db.FCDB import FCDB
#
# logger = Logger()
#
#
# class RegionSpread:
#     def __init__(self, logger, localDb, dataCenterDb):
#         self.logger = logger
#         self.localDb = localDb
#         self.dataCenterDb = dataCenterDb
#         self.fcdb = FCDB(logSql=False, autocommit=True)
#
#     def queryRegions(self):
#         sql = """
#             SELECT code,name from regions r
#             where r.ver = 0 and r.release_status =1
#             and r.status =1 and `level` !=0
#         """
#         return self.dataCenterDb.Query(sql)
#
#     def queryPlatformEnterpriseList(self):
#         sql = """
#             SELECT enterprise_name ,credit_code,comp_code,platform_region_code  from ent_enterprise ee
#             where ee.ent_type= 'T002'
#         """
#         return self.localDb.Query(sql)
#
#     def process(self):
#         # 查询所有区域列表
#         regionsList = self.queryRegions()
#         # 查询所有城投企业列表
#         platformEntList = self.queryPlatformEnterpriseList()
#         for region in regionsList:
#             print(region)
#
#
# if __name__ == "__main__":
#     logger = Logger()
#     localDb = ProdDb(logSql=False, autocommit=True)
#     dataCenterDb = CcxDataCenter(logSql=False, autocommit=True)
#     t = time.perf_counter()
#     logger.info("========计算区域利差数据 开始 ========")
#     task = RegionSpread(logger=logger, localDb=localDb, dataCenterDb=dataCenterDb)
#     task.process()
#
#     cast = (time.perf_counter() - t)
#     m = math.floor(cast / 60)
#     s = cast - m * 60
#     logger.info('总耗时: %d分%.3f秒' % (m, s))
#     logger.info("========计算区域利差数据 结束 ========")
